package top.infopub.mgr.bpa.service.impl;

import org.springframework.stereotype.Service;
import top.infopub.mgr.bpa.dao.BpaMonthEffectDetailDao;
import top.infopub.mgr.bpa.service.BpaMonthEffectDetailService;
import top.infopub.mgr.bpa.vo.BpaMonthEffectDetail;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by wurz on 2021/6/20.
 */
@Service
public class BpaMonthEffectDetailServiceImpl implements BpaMonthEffectDetailService {
    @Resource
    private BpaMonthEffectDetailDao bpaMonthEffectDetailDao;

    @Override
    public int insert(BpaMonthEffectDetail bpaMonthEffectDetail) {
        return bpaMonthEffectDetailDao.insert(bpaMonthEffectDetail);
    }

    @Override
    public int deleteByPrimaryKey(String sguid) {
        return bpaMonthEffectDetailDao.deleteByPrimaryKey(sguid);
    }

    @Override
    public int delete(BpaMonthEffectDetail bpaMonthEffectDetail) {
        return bpaMonthEffectDetailDao.delete(bpaMonthEffectDetail);
    }

    @Override
    public int updateByPrimaryKey(BpaMonthEffectDetail bpaMonthEffectDetail) {
        return bpaMonthEffectDetailDao.updateByPrimaryKey(bpaMonthEffectDetail);
    }

    @Override
    public BpaMonthEffectDetail selectOne(String sguid) {
        return bpaMonthEffectDetailDao.selectOne(sguid);
    }

    @Override
    public List<BpaMonthEffectDetail> selectList(BpaMonthEffectDetail bpaMonthEffectDetail) {
        return bpaMonthEffectDetailDao.selectList(bpaMonthEffectDetail);
    }

    @Override
    public int selectCount(BpaMonthEffectDetail bpaMonthEffectDetail) {
        return bpaMonthEffectDetailDao.selectCount(bpaMonthEffectDetail);
    }

    @Override
    public int insertBatch(List<BpaMonthEffectDetail> bpaMonthEffectDetailList) {
        return bpaMonthEffectDetailDao.insertBatch(bpaMonthEffectDetailList);
    }

    @Override
    public void update(List<BpaMonthEffectDetail> bpaMonthEffectDetailList) {
        if (bpaMonthEffectDetailList == null || bpaMonthEffectDetailList.size() == 0){
            return;
        }
        bpaMonthEffectDetailDao.deleteByYdId(bpaMonthEffectDetailList.get(0).getYdId());
        this.insertBatch(bpaMonthEffectDetailList);
    }

    @Override
    public int deleteByYdId(String ydId) {
        return bpaMonthEffectDetailDao.deleteByYdId(ydId);
    }
}
